package com.example.project.Function.listview;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.project.R;
import com.example.project.key.object.mission;

import java.util.List;

public class employee_alarm_Adapter extends BaseAdapter {

    private List<mission> data;
    private Context context;

    public employee_alarm_Adapter(List<mission> data, Context context) {
        this.data = data;
        this.context = context;
    }

    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        if(view==null)
        {
            view= LayoutInflater.from(context).inflate(R.layout.mission_item,viewGroup,false);
        }

        TextView mission=view.findViewById(R.id.mission_what);
        TextView mission_time = view.findViewById(R.id.mission_time);
        TextView company = view.findViewById(R.id.order_company);
        mission.setText(data.get(i).getMission());
        mission_time.setText(data.get(i).getMission_time());
        company.setText(data.get(i).getCompany());
        return view;
    }
}
